﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
using Omabar.BLL;
using Omabar.Model;

namespace Omabar.CMS.Handler
{
    /// <summary>
    /// SliderEdit 的摘要说明
    /// </summary>
    public class SliderEdit : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            RESP_Info info = new RESP_Info();
            try
            {
                string SLIDER_ID = context.Request["SLIDER_ID"];
                string SLIDER_IMAGE = context.Request["SLIDER_IMAGE"];
                string SLIDER_URL = context.Request["SLIDER_URL"];
                string SLIDER_DES = context.Request["SLIDER_DES"];
                string SLIDER_SORT = context.Request["SLIDER_SORT"];
                string SLIDER_TYPE = context.Request["SLIDER_TYPE"];
                string SLIDER_BAK = context.Request["SLIDER_BAK"];

                Slider_BLL slider_bll = new Slider_BLL();

                SLIDER slider = new SLIDER()
                {
                    SLIDER_ID = SLIDER_ID,
                    SLIDER_IMAGE = SLIDER_IMAGE,
                    SLIDER_URL = SLIDER_URL,
                    SLIDER_DES = SLIDER_DES,
                    SLIDER_SORT = short.Parse( SLIDER_SORT),
                    SLIDER_TYPE = short.Parse( SLIDER_TYPE),
                    SLIDER_BAK = SLIDER_BAK,
                };

                info = slider_bll.Update(slider);
            }
            catch (Exception ex)
            {
                Tom.Net.Log.LogManager.Error("编辑T图失败", ex);
                info.Success = false;
                info.Title = "错误";
                info.Tip = "<h5><p>编辑T图失败</p></h5>";
                info.Url = "SliderList.aspx";
            }

            context.Response.Write(JsonConvert.SerializeObject(info));

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}